cssnode: Special-case TIMESTAMP invalidations
authorBenjamin Otte <otte@redhat.com>
Wed, 25 Feb 2015 17:25:01 +0000 (18:25 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 18 Mar 2015 14:23:33 +0000 (15:23 +0100)
Only invalidate timestamps if the node is marked as invalid. We overload
the meaning of "invalid" as "tracks timestamps".

While I don't like the way this is written, it is an important
optimization because 95+% of nodes don't animate so timestamps don't
matter to them. But timestamps are invalidated 60x per second.

gtk/gtkcssnode.c

index 585ead7ea3481265fbad81b8821c91675a64452a..11200d84ef9ede11ec8adebbebd738473120f09b 100644 (file)
@@ -860,6 +860,12 @@ void
 gtk_css_node_invalidate (GtkCssNode   *cssnode,
                          GtkCssChange  change)
 {
+  if (!cssnode->invalid)
+    change &= ~GTK_CSS_CHANGE_TIMESTAMP;
+
+  if (change == 0)
+    return;
+
   cssnode->pending_changes |= change;
 
   GTK_CSS_NODE_GET_CLASS (cssnode)->invalidate (cssnode);